#pragma once

#include <stdio.h>
#include <yaml.h>

#include "my_thread_base.h"

// clean up handlers.

static inline void
my_file_close_handle(void *data)
{
    FILE *file = (FILE *)data;
    fclose(file);
}

static inline void
my_yaml_parser_delete_handle(void *parser)
{
    yaml_parser_delete((yaml_parser_t *)parser);
}

static inline void
my_yaml_document_delete_handle(void *doc)
{
    yaml_document_delete((yaml_document_t *)doc);
}

static inline void
my_fd_close_handle(void *data)
{
    my_syscall_close((int)(intptr_t)data);
}

static inline void
my_thread_free_handle(void *data)
{
    my_thread_free(data);
}